<?php


namespace app\api\model;


class Userdiscount extends BaseModel {

    protected $hidden = ['createtime'];

    public function getUserDiscount($where){
        return self::where($where)->find();
    }

    public function getUserDiscountList($openid){
        return self::with('discount')->where('openid',$openid)->select();
    }

    public function discount(){
        return $this->hasOne('discount','id','discount_id');
    }

}





